Control edges are used in rock drilling machines to couple the timing of work phase changes or state changes to the position of the percussion piston in relation to the cylinder. This can be achieved by the control edges controlling the flow of pressure medium in the hydraulic system of the rock drilling machine. However, to provide a sufficient reliability ensuring functioning of the rock drilling machine at all occasions, rock drilling machines may require a considerable so called advance. This means that a control edge of the percussion piston passes by a corresponding control edge of the cylinder or distributor before an optimal impact point of the percussion piston. This causes the distributor to start moving, which starts to close a pressure channel connected to the work space before the actual impact takes place. If the impact point moves for some reason, at some point a tank pressure (low pressure) may even exist in the work space, when the percussion piston is still moving towards the impact point. This causes cavitation in work space causing erosion.